/* General Body Styles */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5;
    color: #333;
    margin: 0;
    padding: 0;
    display: flex;
    min-height: 100vh;
    line-height: 1.6;
}

/* App Container */
.app-container {
    flex: 1;
    width: 100%;
    margin: 0;
    background-color: #ffffff;
    border-radius: 0 12px 12px 0; /* Only round right side */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    background-color: #2c3e50;
    color: #ecf0f1;
    width: 220px;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 100vh;
}

.sidebar .logo {
    height: 50px;
    width: auto;
    margin: 0 auto 20px auto;
}

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

/* App Header */
.app-header {
    background-color: #2c3e50; /* Dark blue-gray */
    color: #ecf0f1; /* Light gray */
    padding: 20px 30px;
    display: flex;
    position: relative;
    align-items: center;
    justify-content: space-between;
    border-bottom: 4px solid #3498db; /* Bright blue accent */
}

.app-header .logo {
    height: 50px;
    width: auto;
    margin-right: 15px;
}

.app-header h1 {
    margin: 0;
    font-size: 2em;
    font-weight: 700;
}

/* Hamburger toggle button */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 1.8em;
    cursor: pointer;
}

.nav-link {
    color: #ecf0f1;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.nav-link:hover {
    background-color: #34495e; /* Slightly darker blue-gray */
    color: #ffffff;
}

.nav-link.active {
    background-color: #3498db; /* Bright blue */
    color: #ffffff;
}

/* Logout button */
.btn-logout {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

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

/* Responsive Sidebar (Mobile) */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        display: none;
    }

    .sidebar.open {
        display: flex;
    }

    .app-container {
        width: 100%;
        border-radius: 12px; /* Restore full border radius on mobile */
    }

    .nav-toggle {
        display: block;
    }
}

/* Users table */
.user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.user-table th,
.user-table td {
    padding: 8px;
    border: 1px solid #ddd;
}

.user-table th {
    background-color: #f2f2f2;
    text-align: left;
}

.disabled {
    color: #888;
}

/* Selected user highlighting */
.selected-user {
    background-color: #e8f4fd !important;
    border-left: 4px solid #3498db;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.owner {
    background-color: #e74c3c;
    color: white;
}

.status-badge.available {
    background-color: #27ae60;
    color: white;
}

.status-badge.unavailable {
    background-color: #95a5a6;
    color: white;
}

/* Main Content Area */
.content-area {
    padding: 30px;
}

/* Card Style for Sections */
.card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.card h2 {
    font-size: 1.6em;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.card h2 .icon {
    width: 24px;
    height: 24px;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
}

.form-input,
.form-input-file {
    width: calc(100% - 22px); /* Account for padding and border */
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-input:focus,
.form-input-file:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    outline: none;
}

.form-input-file {
    padding: 8px 12px;
    font-size: 1em;
    border-radius: 6px;
    border: 1px solid #ccc;
    width: auto;
    max-width: 100%;
    height: 40px;
    box-sizing: border-box;
}

/* Checkbox Group Styles */
.sync-options legend {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: #3498db;
}

.checkbox-group label {
    font-weight: normal;
    color: #444;
    margin-bottom: 0;
}

.checkbox-group input[type="checkbox"]:disabled + label {
    color: #888;
}

/* Direction select */
.direction-select {
    margin-left: 10px;
    padding: 4px 6px;
    font-size: 12px;
}

/* Provider toggle */
.provider-toggle {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.provider-toggle label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

/* Button Styles */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    text-decoration: none; /* For <a> tags styled as buttons */
    height: 40px;
    min-width: 140px;
    box-sizing: border-box;
}

.button .icon {
    width: 20px;
    height: 20px;
}

.button.primary {
    background-color: #3498db; /* Bright blue */
    color: #ffffff;
}

.button.primary:hover {
    background-color: #2980b9; /* Darker blue */
}

.button.secondary {
    background-color: #e74c3c; /* Red for stop/destructive actions */
    color: #ffffff;
}

.button.secondary:hover {
    background-color: #c0392b; /* Darker red */
}

.button.tertiary {
    background-color: #f39c12; /* Orange for reset/warning actions */
    color: #ffffff;
}

.button.tertiary:hover {
    background-color: #d68910; /* Darker orange */
}

.button:active {
    transform: translateY(1px);
}

/* Form Actions & Stop Form */
.form-actions,
.stop-form,
.reset-form,
.restore-form,
.auth-form {
    margin-top: 25px;
    display: flex;
    justify-content: center; /* Center buttons by default */
    gap: 15px;
}

/* Align authorization and restore forms with their inputs */
.restore-form,
.auth-form {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
}

.backup-actions {
    margin-bottom: 25px;
    text-align: center;
}

/* Make all file inputs and submit buttons in forms visually consistent */
form .form-input-file,
form button[type="submit"],
.auth-form .button,
.backup-actions .button,
.reset-form .button,
.restore-form .button {
    height: 40px;
    padding: 0 16px;
    min-width: 140px;
    font-size: 1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Ensure paired buttons share identical dimensions */
.backup-actions .button,
.restore-form .button {
    width: 200px;
}

.auth-form .button,
.auth-link.button {
    width: 220px;
}

/* Status Messages (Success, Error, Info) */
.status-message {
    padding: 15px;
    margin-top: 20px;
    border-radius: 6px;
    font-size: 0.95em;
    text-align: center;
}

.status-message.success {
    background-color: #d4edda; /* Light green */
    color: #155724; /* Dark green */
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background-color: #f8d7da; /* Light red */
    color: #721c24; /* Dark red */
    border: 1px solid #f5c6cb;
}

.status-message.info {
    background-color: #d1ecf1; /* Light blue */
    color: #0c5460; /* Dark blue */
    border: 1px solid #bee5eb;
}

/* Footer */
.app-footer {
    background-color: #ecf0f1; /* Light gray */
    color: #7f8c8d; /* Medium gray */
    text-align: center;
    padding: 20px;
    font-size: 0.9em;
    border-top: 1px solid #dcdcdc;
}

/* Authorization Page Specifics */
.authorize-section .description,
.backup-section .description {
    font-size: 1.05em;
    color: #555;
    margin-bottom: 20px;
    text-align: center;
}

.auth-steps {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
}

.auth-steps p {
    margin-bottom: 10px;
    color: #333;
}

.auth-link {
    margin: 10px 0 20px; /* Add more margin around the auth link button */
}

/* OAuth callback code box */
.oauth-code {
    font-family: monospace;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 6px;
    word-break: break-all;
    text-align: center;
    margin-bottom: 15px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .app-header .logo {
        margin-right: 0;
        margin-bottom: 10px;
        height: 40px;
    }

    .nav-toggle {
        display: block;
        position: absolute;
        top: 20px;
        right: 20px;
    }

    .content-area {
        padding: 15px;
    }

    .card {
        padding: 18px;
    }

    .card h2 {
        font-size: 1.4em;
    }

    .form-group label {
        font-size: 0.95em;
    }

    .button .icon {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .app-container {
        margin: 10px;
    }

    .app-header h1 {
        font-size: 1.6em;
    }

    .nav-link {
        padding: 10px 0;
        font-size: 0.9em;
        text-align: center;
    }

    .form-input,
    .form-input-file,
    .checkbox-group label {
        font-size: 0.9em;
    }

    .button {
        font-size: 0.9em;
        padding: 8px 12px;
        min-width: 120px;
    }

    .form-actions,
    .stop-form,
    .restore-form {
        flex-direction: column;
        align-items: center;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .restore-form .form-group {
        width: 100%;
    }

    .restore-form .form-input-file {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Footer link styles */
.app-footer a {
    color: #3498db;
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}
