/* style.css - Responsive styles for Worker Hours Tracker */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Login Screen */
#loginScreen.active {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 10px;
}

.logo p {
    color: var(--text-secondary);
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Cards */
.form-card {
    background: var(--card-background);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.form-card h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

input[readonly] {
    background-color: #f1f5f9;
}

textarea {
    resize: vertical;
}

.help-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Header */
.header {
    background: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h2 {
    color: var(--primary-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sync-status {
    font-size: 20px;
    color: var(--success-color);
}

.sync-status.offline {
    color: var(--danger-color);
}

.sync-status.syncing {
    color: var(--warning-color);
}

/* Navigation Tabs */
.nav-tabs {
    background: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    overflow-x: auto;
    position: sticky;
    top: 65px;
    z-index: 99;
}

.tab-btn {
    flex: 1;
    padding: 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
    padding-top: 20px;
}

.tab-content.active {
    display: block;
}

/* Signature Pad */
.signature-pad {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    background: white;
}

.signature-pad canvas {
    display: block;
    border: 1px dashed var(--border-color);
    cursor: crosshair;
    touch-action: none;
}

/* Summary Card */
.summary-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.summary-card h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.summary-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.summary-item:last-child {
    border-bottom: none;
}

/* Manage Section */
.manage-section {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
}

.manage-section:last-child {
    border-bottom: none;
}

.manage-section h4 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

/* Password Inputs */
input[type="password"] {
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

input[type="password"]::placeholder {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    letter-spacing: normal;
}

/* Password strength indicator (optional) */
.password-strength {
    height: 4px;
    border-radius: 2px;
    margin-top: 8px;
    background: var(--border-color);
    transition: all 0.3s;
}

.password-strength.weak {
    width: 33%;
    background: var(--danger-color);
}

.password-strength.medium {
    width: 66%;
    background: var(--warning-color);
}

.password-strength.strong {
    width: 100%;
    background: var(--success-color);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
    max-width: 90%;
}

.toast.show {
    opacity: 1;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

/* Error Message */
.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

th {
    background: var(--primary-color);
    color: white;
    padding: 12px;
    text-align: left;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
    border-bottom: none;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

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

.status-unpaid {
    background: #fee2e2;
    color: #991b1b;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
}

/* Delete Button Styles */
.btn-delete {
    background: var(--danger-color);
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Worker/Job List Styles */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    background: white;
    transition: all 0.3s;
}

.list-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.list-item-info {
    flex: 1;
}

.list-item-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.list-item-details {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.list-item-actions {
    margin-left: 15px;
}

/* Quick Summary Styles */
.quick-summary {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.quick-summary h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 20px;
}

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

.summary-table th {
    background: var(--primary-color);
    color: white;
    padding: 14px 10px;
    text-align: left;
    font-size: 16px;
}

.summary-table td {
    padding: 14px 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
}

.summary-table tr:hover {
    background: #f8fafc;
}

.total-row {
    font-weight: bold;
    background: #f1f5f9;
}

.total-row td {
    border-top: 2px solid var(--primary-color);
}

.amount-owed {
    color: var(--danger-color);
    font-weight: 600;
    font-size: 18px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-direction: column;
        gap: 10px;
    }

    .nav-tabs {
        top: 95px;
    }

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

    .btn {
        width: 100%;
        min-height: 48px;
        font-size: 18px;
        padding: 14px 24px;
    }

    /* Larger signature pad for mobile */
    .signature-pad canvas {
        width: 100%;
        height: 250px;
    }

    /* Larger fonts for mobile readability */
    label {
        font-size: 18px;
        font-weight: 600;
    }

    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 18px;
        padding: 14px;
        min-height: 48px;
    }

    .form-card h3 {
        font-size: 24px;
    }

    .tab-btn {
        font-size: 18px;
        padding: 18px 12px;
    }

    .help-text {
        font-size: 16px;
    }
}

/* Print Styles */
@media print {
    .header,
    .nav-tabs,
    .btn,
    .form-actions {
        display: none !important;
    }
    
    .form-card {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
