/* Time Tracker Styles */

.time-tracker-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

/* Authentication Screen */
.auth-container {
    max-width: 450px;
    margin: 4rem auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #333;
}

.auth-container .subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    margin-bottom: 1.5rem;
    color: #333;
}

.switch-auth {
    text-align: center;
    margin-top: 1.5rem;
    color: #666;
}

.switch-auth a {
    color: #007bff;
    text-decoration: none;
}

.switch-auth a:hover {
    text-decoration: underline;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.875rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #1e7e34;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.app-header h1 {
    margin: 0;
    color: #333;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    color: #666;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    margin: 0;
    color: #333;
}

/* Projects List */
.projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.2s;
}

.project-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.project-info h3 {
    margin: 0 0 0.5rem 0;
    color: #333;
}

.project-rate {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.project-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-top: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 0.875rem;
    color: #666;
}

.stat-value {
    font-weight: 600;
    color: #333;
}

.stat-amount {
    color: #28a745;
}

.project-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Summary Box */
.summary-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.summary-label {
    font-size: 0.875rem;
    color: #666;
    font-weight: 500;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.timer-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.timer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.timer-header h3 {
    margin: 0;
    color: #333;
}

.timer-subtitle {
    margin: 0.25rem 0 0;
    color: #666;
    font-size: 0.95rem;
}

.timer-display {
    font-size: 1.75rem;
    font-weight: 700;
    color: #007bff;
}

.timer-project-label {
    color: #555;
    margin: 0.25rem 0 1rem;
    font-size: 0.95rem;
}

.timer-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* Entries List */
.entries-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.entry-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.2s;
}

.entry-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.entry-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.entry-date {
    font-weight: 600;
    color: #333;
}

.entry-time {
    color: #007bff;
    font-weight: 500;
}

.entry-amount {
    color: #28a745;
    font-weight: 600;
    margin-left: auto;
}

.entry-notes {
    color: #666;
    margin-bottom: 1rem;
    white-space: pre-wrap;
}

.entry-actions {
    display: flex;
    gap: 0.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
    font-size: 1.125rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.modal-wide {
    max-width: 700px;
}

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

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #f8f9fa;
}

.modal-content form {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Error Message */
.error-message,
.info-message,
.success-message {
    font-size: 0.875rem;
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    border: 1px solid transparent;
    display: none;
}

.error-message {
    color: #dc3545;
    background: #f8d7da;
    border-color: #f5c6cb;
}

.info-message {
    color: #0c5460;
    background: #d1ecf1;
    border-color: #bee5eb;
}

.success-message {
    color: #155724;
    background: #d4edda;
    border-color: #c3e6cb;
}

.error-message:not(:empty),
.info-message:not(:empty),
.success-message:not(:empty) {
    display: block;
}

/* Logo Preview */
.logo-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    display: none;
}

.logo-preview:not(:empty) {
    display: block;
}

.logo-preview img {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
}

/* Header Buttons */
.header-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Import Modal */
.import-info {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.import-info p {
    margin: 0.5rem 0;
    color: #92400e;
    font-size: 0.9rem;
}

.import-info p:first-child {
    margin-top: 0;
}

.import-info p:last-child {
    margin-bottom: 0;
}

.success-message {
    color: #059669;
    background: #d1fae5;
    padding: 0.75rem;
    border-radius: 4px;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Invoice Styles */
.modal-invoice {
    max-width: 900px;
}

.modal-header .invoice-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.invoice-content {
    padding: 1.5rem;
    background: white;
}

.invoice-page {
    max-width: 960px;
    margin: 0 auto;
    font-family: system-ui, -apple-system, sans-serif;
    color: #111827;
}

.invoice-top {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.invoice-branding {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.invoice-logo img {
    max-width: 140px;
    max-height: 70px;
    object-fit: contain;
}

.invoice-from h2 {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
}

.invoice-from p {
    margin: 0.15rem 0;
    color: #4b5563;
}

.invoice-meta {
    text-align: right;
}

.invoice-meta h1 {
    margin: 0 0 0.5rem;
    letter-spacing: 0.18em;
    font-size: 1.75rem;
    text-transform: uppercase;
}

.invoice-meta-list {
    margin: 0;
    padding: 0;
}

.invoice-meta-list .meta-row {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin: 0.25rem 0;
}

.invoice-meta-list .meta-label {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
}

.invoice-meta-list .meta-value {
    font-weight: 600;
    color: #111827;
    font-variant-numeric: tabular-nums;
}

.invoice-info-grid {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.invoice-to h3 {
    margin: 0 0 0.85rem;
    font-size: 1.1rem;
}

.invoice-to p {
    margin: 0.2rem 0;
    color: #4b5563;
}

.invoice-summary-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    min-width: 260px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
    font-weight: 600;
    color: #111827;
    font-variant-numeric: tabular-nums;
}

.summary-line.total {
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
    font-size: 1.15rem;
}

.summary-help {
    margin: 0;
    color: #6b7280;
    font-size: 0.95rem;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.invoice-table thead {
    background: #f4f6fb;
}

.invoice-table th,
.invoice-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.invoice-table th {
    font-weight: 600;
    color: #1f2933;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}

.invoice-table td {
    color: #374151;
}

.invoice-table .numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.invoice-table .date-col {
    width: 120px;
}

.invoice-table tbody tr:hover {
    background: #f9fafb;
}

.invoice-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #6b7280;
    font-style: italic;
}

.invoice-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 0.95rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .time-tracker-container {
        padding: 1rem 0.5rem;
    }

    .auth-container {
        margin: 2rem auto;
        padding: 1.5rem;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .projects-list {
        grid-template-columns: 1fr;
    }

    .summary-box {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .entry-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .entry-amount {
        margin-left: 0;
    }

    .project-actions {
        flex-direction: column;
    }

    .project-actions .btn {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
    }

    .invoice-top,
    .invoice-info-grid {
        flex-direction: column;
        align-items: flex-start;
    }

    .invoice-meta {
        text-align: left;
    }

    .invoice-summary-card {
        width: 100%;
        min-width: unset;
    }
}

/* Invoice History */
.invoice-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.invoice-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.invoice-history-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.invoice-history-info .invoice-number {
    font-weight: 600;
    color: #111827;
}

.invoice-history-info .invoice-date {
    color: #6b7280;
}

.invoice-history-info .invoice-amount {
    font-weight: 600;
    color: #059669;
}

.invoice-history-info .invoice-status {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.invoice-status.status-billed {
    background: #fef3c7;
    color: #92400e;
}

.invoice-status.status-paid {
    background: #d1fae5;
    color: #065f46;
}

.invoice-history-actions {
    display: flex;
    gap: 0.5rem;
}

/* Invoice Paid Banner */
.invoice-paid-banner {
    position: absolute;
    top: 40px;
    right: -35px;
    background: #059669;
    color: white;
    padding: 0.5rem 3rem;
    font-weight: 700;
    font-size: 0.9rem;
    transform: rotate(45deg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.invoice-page {
    position: relative;
    overflow: hidden;
}

/* Print Styles */
@media print {
    .app-header,
    .section-header,
    .project-actions,
    .entry-actions,
    .btn,
    .modal {
        display: none !important;
    }

    .entry-card,
    .project-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
