@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #FFFFFF;
    --bg-surface: #F8F9FA;
    --primary-red: #DC2626;
    --primary-red-hover: #B91C1C;
    --text-dark: #1F2937;
    --text-light: #6B7280;
    --border-color: #E5E7EB;
    
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-surface);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-weight: 600;
}

p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

a {
    color: var(--primary-red);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-red-hover);
}

/* Layout */
.app-container {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* Top Navbar */
.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1.5rem;
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    height: 60px;
}

.top-nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar {
    width: 250px;
    min-width: 250px;
    background-color: var(--bg-main);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    position: sticky;
    top: 60px;
    align-self: flex-start;
    transition: width 0.3s ease, min-width 0.3s ease;
    overflow-x: hidden;
}

.sidebar.collapsed {
    width: 70px;
    min-width: 70px;
}

.top-bar-toggle:hover, .top-profile-link:hover {
    background-color: var(--border-color) !important;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-light);
    font-weight: 500;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    transition: background-color 0.2s, color 0.2s, border-left-color 0.2s, padding 0.3s ease;
}

.sidebar-nav li a svg {
    flex-shrink: 0;
    margin-right: 12px;
}

.nav-text {
    transition: opacity 0.2s ease;
    opacity: 1;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
}

.sidebar-nav li a:hover, .sidebar-nav li a.active {
    background-color: var(--bg-surface);
    color: var(--primary-red);
    border-left-color: var(--primary-red);
}

.main-content {
    flex: 1;
    padding: 2rem;
    background-color: var(--bg-surface);
    overflow-y: auto;
}

/* Container for non-sidebar pages (Auth) */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-surface);
    padding: 1rem;
}

.card {
    background-color: var(--bg-main);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 2rem;
    width: 100%;
}

.auth-card {
    max-width: 400px;
}

.text-center { text-align: center; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.w-100 { width: 100%; }

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-dark);
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    outline: 0;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
}

.btn-primary {
    color: #fff;
    background-color: var(--primary-red);
    border-color: var(--primary-red);
}

.btn-primary:hover {
    background-color: var(--primary-red-hover);
    border-color: var(--primary-red-hover);
    color: #fff;
}

.btn-outline {
    color: var(--text-dark);
    background-color: transparent;
    border-color: var(--border-color);
}

.btn-outline:hover {
    background-color: var(--bg-surface);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 4px;
}

/* Grid System */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Dashboard Cards */
.stat-card {
    background-color: var(--bg-main);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
}

.stat-card .stat-title {
    color: var(--text-light);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 0.5rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

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

.table th, .table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--bg-surface);
    font-weight: 600;
    color: var(--text-dark);
}

.table tbody tr:hover {
    background-color: rgba(248, 249, 250, 0.5);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35em 0.8em;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    border-radius: 9999px;
}

.badge-pending { background-color: var(--warning); color: #fff; }
.badge-shortlisted { background-color: var(--info); color: #fff; }
.badge-approved { background-color: var(--success); color: #fff; }
.badge-rejected { background-color: var(--danger); color: #fff; }
.badge-active { background-color: var(--success); color: #fff; }
.badge-closed { background-color: var(--text-light); color: #fff; }

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 6px;
}

.alert-success {
    color: #065f46;
    background-color: #d1fae5;
    border-color: #a7f3d0;
}

.alert-danger {
    color: #991b1b;
    background-color: #fee2e2;
    border-color: #fecaca;
}

/* Form Builder styles */
.builder-field {
    border: 1px solid var(--border-color);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    background-color: var(--bg-surface);
}

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

.builder-options {
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: row;
    }
    
    .sidebar {
        position: fixed;
        left: -250px;
        top: 60px;
        height: calc(100vh - 60px);
        width: 250px;
        min-width: 250px;
        z-index: 100;
        box-shadow: 4px 0 10px rgba(0,0,0,0.1);
        transition: left 0.3s ease;
        border-right: 1px solid var(--border-color);
    }
    
    .sidebar.mobile-open {
        left: 0;
    }

    /* Override .collapsed styles on mobile */
    .sidebar.collapsed {
        width: 250px;
        min-width: 250px;
    }
    .sidebar.collapsed .nav-text {
        opacity: 1;
    }

    /* Top nav changes for mobile */
    .top-nav-right .user-name {
        display: none;
    }
    
    .grid-cols-2, .grid-cols-3, .grid-cols-4 {
        grid-template-columns: 1fr;
    }
}

/* Google Forms Aesthetic */
.g-form-container {
    max-width: 640px;
    margin: 2rem auto;
    font-family: 'Roboto', 'Inter', sans-serif;
}

.g-form-header-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 12px;
    border: 1px solid #dadce0;
    border-top: 10px solid var(--primary-red);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.g-form-title {
    font-size: 2rem;
    color: #202124;
    font-weight: 400;
    margin-bottom: 12px;
}

.g-form-desc-main {
    font-size: 0.875rem;
    color: #202124;
    line-height: 1.5;
    margin-bottom: 16px;
}

.g-form-link {
    display: inline-block;
    color: #1a73e8;
    text-decoration: underline;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.g-form-divider {
    border: 0;
    height: 1px;
    background: #dadce0;
    margin: 16px 0;
}

.g-form-account-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #5f6368;
    margin-bottom: 16px;
}

.g-switch-account {
    color: #1a73e8;
    text-decoration: none;
    font-weight: 500;
}

.g-form-required-note {
    font-size: 0.875rem;
    color: var(--primary-red);
}

.g-form-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 12px;
    border: 1px solid #dadce0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.g-form-question {
    font-size: 1rem;
    color: #202124;
    font-weight: 500;
    margin-bottom: 8px;
}

.g-form-desc {
    font-size: 0.75rem;
    color: #5f6368;
    margin-bottom: 16px;
}

.g-form-input-wrapper {
    margin-top: 16px;
}

.g-form-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid #dadce0;
    padding: 8px 0;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
    background: transparent;
}

.g-form-input:focus {
    border-bottom: 2px solid var(--primary-red);
}

.g-form-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 0.875rem;
    outline: none;
}

.g-form-radio-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    color: #202124;
    cursor: pointer;
}

.g-form-radio-label input[type="radio"],
.g-form-radio-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.g-form-submit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
}

.g-form-submit-btn {
    background-color: var(--primary-red);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.g-form-submit-btn:hover {
    background-color: #d1121d;
}

.g-form-clear-btn {
    background: none;
    border: none;
    color: #1a73e8;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.g-form-clear-btn:hover {
    background: rgba(26, 115, 232, 0.04);
    border-radius: 4px;
}

.template-card-preview:hover {
    border-color: var(--primary-red) !important;
}

.template-gallery::-webkit-scrollbar {
    height: 8px;
}
.template-gallery::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 4px;
}
.template-gallery::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 4px;
}
.template-gallery::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
}
