/*
 * schaals.ee Kundenportal
 * Design angelehnt an die Hauptwebseite
 */

@import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,400,400i,600");

/* Reset & Basics */
*, *:before, *:after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Source Sans Pro", Helvetica, sans-serif;
    font-weight: 300;
    line-height: 1.65;
    background: #f5f5f5;
    color: #000;
    min-height: 100vh;
}

a {
    color: #000;
    text-decoration: underline;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: none;
    color: #666;
}

h1, h2, h3, h4 {
    font-weight: 400;
    margin: 0 0 1rem 0;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
    margin: 0 0 1.5rem 0;
}

/* Layout */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 2rem;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #fff 0%, #f5f5f5 100%);
}

.login-box {
    background: #fff;
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-size: 1.8rem;
    font-weight: 300;
    margin: 0;
}

.login-logo h1 span {
    color: #ccc;
}

.login-logo p {
    color: #999;
    font-size: 0.9rem;
    margin: 0.5rem 0 0 0;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 400;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.8rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 300;
    border: 1px solid #ddd;
    background: #fff;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #000;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #000;
    color: #fff;
    width: 100%;
}

.btn-primary:hover {
    background: #333;
}

.btn-secondary {
    background: #fff;
    color: #000;
    border: 1px solid #000;
}

.btn-secondary:hover {
    background: #000;
    color: #fff;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-danger {
    background: #c0392b;
    color: #fff;
}

.btn-danger:hover {
    background: #a93226;
}

.btn-success {
    background: #27ae60;
    color: #fff;
}

.btn-success:hover {
    background: #219a52;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-error {
    background: #fdeaea;
    border-left: 3px solid #c0392b;
    color: #a93226;
}

.alert-success {
    background: #e8f6ed;
    border-left: 3px solid #27ae60;
    color: #1e8449;
}

.alert-info {
    background: #eaf2f8;
    border-left: 3px solid #3498db;
    color: #2980b9;
}

/* Header */
.header {
    background: #fff;
    padding: 1rem 2rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    font-size: 1.2rem;
    font-weight: 300;
    text-decoration: none;
    color: #000;
}

.header-logo span {
    color: #ccc;
}

.header-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.header-nav a {
    text-decoration: none;
    font-size: 0.9rem;
}

.header-user {
    color: #999;
    font-size: 0.9rem;
}

/* Dashboard */
.dashboard {
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-weight: 300;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-card h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #999;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 400;
}

.stat-card .value.warning {
    color: #e67e22;
}

.stat-card .value.danger {
    color: #c0392b;
}

/* Tables */
.table-container {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow-x: auto;
}

.table-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 400;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

th {
    font-weight: 400;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #999;
    background: #fafafa;
}

tr:hover {
    background: #fafafa;
}

/* Status Badges */
.status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-draft { background: #f0f0f0; color: #666; }
.status-sent { background: #eaf2f8; color: #2980b9; }
.status-viewed { background: #fef5e7; color: #d68910; }
.status-paid { background: #e8f6ed; color: #1e8449; }
.status-overdue { background: #fdeaea; color: #a93226; }

/* Admin Specific */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background: #1a1a1a;
    color: #fff;
    padding: 2rem 0;
}

.admin-sidebar-logo {
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid #333;
    margin-bottom: 1rem;
}

.admin-sidebar-logo h2 {
    font-size: 1rem;
    font-weight: 300;
    margin: 0;
}

.admin-sidebar-logo span {
    color: #666;
}

.admin-sidebar-logo small {
    display: block;
    color: #666;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.admin-nav a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #999;
    text-decoration: none;
    transition: all 0.2s ease;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: #fff;
    background: #333;
}

.admin-main {
    flex: 1;
    background: #f5f5f5;
}

.admin-header {
    background: #fff;
    padding: 1rem 2rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-content {
    padding: 2rem;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .login-box {
        padding: 2rem;
    }

    .admin-sidebar {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    th, td {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

@media screen and (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #999; }
.text-small { font-size: 0.85rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.warning { color: #e67e22; }

/* DataTables Overrides */
.dataTables_wrapper {
    padding: 1rem 1.5rem;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    border: 1px solid #ddd;
    margin-left: 0.5rem;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: #000;
}

.dataTables_wrapper .dataTables_length select {
    padding: 0.4rem 0.8rem;
    font-family: inherit;
    border: 1px solid #ddd;
    margin: 0 0.5rem;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.85rem;
    color: #999;
    padding-top: 1rem;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 1rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.4rem 0.8rem;
    margin: 0 0.15rem;
    border: 1px solid #ddd !important;
    background: #fff !important;
    color: #000 !important;
    cursor: pointer;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f5f5f5 !important;
    border-color: #000 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #000 !important;
    color: #fff !important;
    border-color: #000 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #ccc !important;
    cursor: default;
}

table.dataTable thead th {
    border-bottom: 1px solid #eee;
}

table.dataTable.no-footer {
    border-bottom: none;
}

/* Contract Form */
.contract-form {
    padding: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.form-grid .form-group {
    margin-bottom: 0;
}

.form-grid .form-group.full-width {
    grid-column: 1 / -1;
}

.form-grid select,
.form-grid textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 300;
    border: 1px solid #ddd;
    background: #fff;
    transition: border-color 0.2s ease;
}

.form-grid select:focus,
.form-grid textarea:focus {
    outline: none;
    border-color: #000;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

/* Placeholder Insert Bar */
.placeholder-insert {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.placeholder-insert select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.9rem;
    border: 1px solid #ddd;
    background: #fff;
}

.placeholder-insert select:focus {
    outline: none;
    border-color: #000;
}

@media screen and (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Header Nav Active */
.header-nav a.active {
    font-weight: 600;
}

/* Badge (for pending count) */
.badge {
    display: inline-block;
    background: #c0392b;
    color: #fff;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    margin-left: 0.25rem;
    vertical-align: middle;
}

/* Contracts Grid */
.contracts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.contract-card {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 1.5rem;
    border-left: 4px solid #ddd;
}

.contract-card.accepted {
    border-left-color: #27ae60;
}

.contract-card.pending {
    border-left-color: #e67e22;
}

.contract-card-header h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
}

.contract-version {
    font-size: 0.8rem;
    color: #999;
}

.contract-card-status {
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.contract-card-actions {
    margin-top: 1rem;
}

/* Contract View */
.contract-view {
    max-width: 900px;
    margin: 0 auto;
}

.contract-header {
    margin-bottom: 2rem;
}

.contract-header h1 {
    margin: 1rem 0 0.25rem 0;
}

.contract-content {
    background: #fff;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    line-height: 1.8;
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid #eee;
}

.contract-content h2 {
    font-size: 1.3rem;
    margin-top: 2rem;
}

.contract-content h2:first-child {
    margin-top: 0;
}

.contract-content h3 {
    font-size: 1.1rem;
    margin-top: 1.5rem;
}

.contract-content p {
    margin: 1rem 0;
}

.contract-content ul, .contract-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.contract-content li {
    margin: 0.5rem 0;
}

.contract-accept {
    background: #fff;
    padding: 1.5rem 2rem;
    margin-top: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-top: 3px solid #000;
}

.contract-accept form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 0.25rem;
    width: 18px;
    height: 18px;
}

.checkbox-label span {
    flex: 1;
}

.contract-accept .btn {
    align-self: flex-start;
}

.contract-accepted-info {
    background: #e8f6ed;
    padding: 1rem 1.5rem;
    margin-top: 1rem;
    border-left: 3px solid #27ae60;
}

.contract-accepted-info p {
    margin: 0;
    color: #1e8449;
}
