/* style.css - Enhanced Modern UI */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #f8fafc;
    --accent-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --border-radius: 12px;
    --border-radius-lg: 16px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    margin: 0;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Main Container Styles */
.main-container {
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container,
.dashboard-container,
.report-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin: 20px;
    padding: 32px;
    width: 100%;
    max-width: 800px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.login-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

.login-container {
    max-width: 450px;
    margin: 50px auto;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.dashboard-container,
.report-container {
    margin: 20px auto;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 2rem;
    margin-top: 0;
}

h3 {
    font-size: 1.5rem;
    margin-top: 0;
}

p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 14px;
    color: #495057;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background-color: #ffffff;
    transition: all 0.2s ease;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.form-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

.form-group small {
    font-size: 12px;
    color: #6c757d;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    color: white;
    padding: 14px 24px;
    text-decoration: none;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    position: relative;
    overflow: hidden;
    min-height: 48px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

.btn-logout {
    background-color: #dc3545;
    padding: 12px 20px;
}

.btn-logout:hover {
    background-color: #c82333;
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.2);
}

.btn-checkin {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.btn-checkin:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-checkout {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1f2937;
}

.btn-checkout:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.2);
}

.btn-disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.btn-edit {
    background-color: #ffc107;
    color: #212529;
}

.btn-edit:hover {
    background-color: #ffca2c;
    color: #212529;
}

.btn-delete {
    background-color: #dc3545;
    color: #fff;
}

.btn-delete:hover {
    background-color: #c82333;
    color: #fff;
}

/* Message Styles */
.error-msg {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    padding: 10px;
    border-radius: 8px;
    margin-top: 20px;
}

.success-msg {
    color: #0f5132;
    background-color: #d1e7dd;
    border: 1px solid #badbcc;
    padding: 10px;
    border-radius: 8px;
    margin-top: 20px;
}

/* Header Styles */
.header {
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.header a.btn {
    float: right;
    margin-top: -50px;
}

/* Table Styles */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 14px;
}

table th,
table td {
    border: 1px solid #e9ecef;
    padding: 12px;
    text-align: left;
    white-space: nowrap;
    vertical-align: middle;
}

table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #343a40;
}

table tr:nth-child(even) {
    background-color: #fcfcfc;
}

table tr:hover {
    background-color: #f1f3f5;
}

/* Admin Sidebar Styles */
.admin-page-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: #212529;
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid #343a40;
}

.sidebar-header h3 {
    color: #fff;
    margin: 0;
    font-size: 20px;
    text-align: left;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 15px 0;
}

.sidebar-nav a {
    color: #adb5bd;
    padding: 12px 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-nav a:hover {
    background-color: #343a40;
    color: #fff;
}

.sidebar-nav a.active {
    background-color: #0d6efd;
    color: #fff;
    border-left: 3px solid #fff;
}

.btn-logout-sidebar {
    background-color: #dc3545;
    color: #fff !important;
    text-align: center;
    margin: 15px 20px;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-logout-sidebar:hover {
    background-color: #c82333 !important;
}

.main-content {
    flex-grow: 1;
    background-color: #f4f7f6;
    padding: 30px;
    width: calc(100% - 250px);
    box-sizing: border-box;
}

/* Filter Form Styles */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 15px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.filter-form .form-group {
    flex: 1;
    margin-bottom: 0;
    min-width: 150px;
}

.filter-form input[type="date"],
.filter-form input[type="text"] {
    padding: 8px 12px;
}

.filter-form .btn-small {
    padding: 8px 15px;
}

/* Status Styles */
.status-light {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
    max-width: 150px;
}

.status-unknown {
    background-color: #e9ecef;
    color: #495057;
}

.status-connected {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-failed {
    background-color: #f8d7da;
    color: #842029;
}

/* Download Form Styles */
.download-form {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.download-form label {
    font-size: 12px;
    font-weight: 600;
    margin: 0;
}

.download-form input[type="date"] {
    padding: 5px;
    border-radius: 5px;
    border: 1px solid #ced4da;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 5px;
    white-space: nowrap;
}

/* Profile Picture Styles */
.current-profile-pic {
    max-width: 150px;
    height: auto;
    border-radius: 8px;
    border: 1px solid #ddd;
}

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

.header-profile-pic {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e9ecef;
}

.default-pic {
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 24px;
}

.table-profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e9ecef;
    font-size: 20px;
}

.table-profile-pic.default-pic {
    width: 40px;
    height: 40px;
}

/* Time Display Styles */
.time-display {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
}

.time-box {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    flex: 1;
}

.time-box h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

.time-box p {
    margin: 0;
    font-size: 24px;
    color: #212529;
    font-weight: 600;
}

/* Attendance Card Styles */
.attendance-card {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    margin-top: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
}

.card-header .icon {
    font-size: 20px;
    color: #0d6efd;
}

.card-header h4 {
    margin: 0;
    font-size: 18px;
    color: #343a40;
}

.card-body {
    padding: 20px;
}

.btn-filter {
    background-color: #0d6efd;
}

.btn-filter:hover {
    background-color: #0b5ed7;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.dashboard-icon-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.dashboard-icon-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.dashboard-icon-button:hover::before {
    opacity: 0.05;
}

.dashboard-icon-button .icon {
    font-size: 56px;
    color: var(--primary-color);
    margin-bottom: 16px;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.2));
}

.dashboard-icon-button span {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.dashboard-icon-button:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.dashboard-icon-button:hover .icon {
    transform: scale(1.1);
    color: var(--primary-dark);
}

.dashboard-icon-button:hover span {
    color: var(--primary-dark);
}

/* Shift Assignment Styles */
.shift-assignment-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
}

.assignment-form-card,
.calendar-card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

.assignment-form-card h3,
.calendar-card h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.assignment-form-card h3 i,
.calendar-card h3 i {
    color: var(--primary-color);
}

.message-container {
    margin-top: 1rem;
    display: none;
}

#calendar {
    height: 600px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .admin-page-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .sidebar-header {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        width: 100%;
    }

    .sidebar-nav a {
        padding: 15px 20px;
        white-space: nowrap;
    }

    .btn-logout-sidebar {
        display: none;
    }

    .main-content {
        width: 100%;
        padding: 15px;
    }

    .header {
        text-align: left;
    }

    .header a.btn {
        float: none;
        margin-top: 15px;
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .login-container,
    .dashboard-container,
    .report-container {
        margin: 20px auto;
        padding: 20px;
    }

    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .time-display {
        flex-direction: column;
    }

    .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .action-buttons a {
        width: 100%;
        text-align: center;
        margin-left: 0;
    }

    .shift-assignment-grid {
        grid-template-columns: 1fr;
    }

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

/* Machine Log Viewer Specific Styles */
.machine-log-container {
    display: flex;
    min-height: 100vh;
}

.machine-log-content {
    flex-grow: 1;
    background-color: #f4f7f6;
    padding: 30px;
    width: calc(100% - 250px);
    box-sizing: border-box;
}

.filter-card,
.toolbar-card,
.table-card,
.calendar-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 24px;
}

.table-wrapper {
    overflow-x: auto;
}

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

.table-wrapper thead {
    background-color: #f8f9fa;
}

.table-wrapper th {
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

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

.table-wrapper tbody tr:hover {
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-in {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-out {
    background-color: #fee2e2;
    color: #7f1d1d;
}

.badge-time {
    background-color: #dbeafe;
    color: #0c2d6b;
}

.badge-empty {
    background-color: #f3f4f6;
    color: #6b7280;
}

.pagination-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.export-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
    color: white;
}

.export-btn-excel {
    background-color: #10b981;
}

.export-btn-excel:hover {
    background-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.export-btn-pdf {
    background-color: #ef4444;
}

.export-btn-pdf:hover {
    background-color: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

#shift-calendar {
    height: 500px;
}

.no-data {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.no-data i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

@media (max-width: 1024px) {
    .grid-2col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .machine-log-content {
        width: 100%;
        padding: 15px;
    }
    .pagination-section {
        flex-direction: column;
        align-items: stretch;
    }
    .export-section {
        flex-direction: column;
        align-items: stretch;
    }
    .export-btn {
        justify-content: center;
        width: 100%;
    }
    .filter-card {
        padding: 16px;
    }
    .table-wrapper th,
    .table-wrapper td {
        padding: 8px 12px;
        font-size: 12px;
    }
}

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

    .time-display {
        flex-direction: column;
        gap: 10px;
    }

    .time-box {
        padding: 15px;
    }

    table {
        font-size: 12px;
    }

    table th,
    table td {
        padding: 8px;
    }
}
