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

:root {
    --primary-color: #9e8e63;
    --primary-hover: #8a7a52;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --input-bg: #eef4ff;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
    --border-radius: 12px;
    --transition-fast: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   AUTH LAYOUT (Login / Setup)
   ============================================ */
.auth-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 30px 20px;
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
    line-height: 1.2;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

.auth-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 450px;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
}

.auth-card h2,
.auth-card h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 25px;
}

.auth-footer {
    text-align: center;
    margin-top: 40px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    background-color: var(--input-bg);
    font-size: 1rem;
    color: var(--text-main);
    transition: var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(158, 142, 99, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.password-group {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    background: none;
    border: none;
    padding: 5px;
    -webkit-tap-highlight-color: transparent;
}

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

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

.form-actions .btn-primary {
    flex: 2;
}

.form-actions .btn-action {
    flex: 1;
    margin-top: 10px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    margin-top: 10px;
    -webkit-tap-highlight-color: transparent;
}

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

.btn-primary:active {
    transform: scale(0.98);
}

.btn-action {
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-main);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.btn-action:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

.btn-action:active {
    transform: scale(0.97);
}

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

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

.btn-sm {
    padding: 8px 12px;
    font-size: 0.8rem;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    background: var(--card-bg);
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 10px;
}

.navbar-brand {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.4rem;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    transition: color 0.2s;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 0.9rem;
}

.nav-links a:hover {
    color: var(--primary-color);
    background: rgba(158, 142, 99, 0.08);
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 8px;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
main {
    flex: 1;
    padding: 40px 5%;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.page-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.page-title h2 {
    font-size: 1.8rem;
    color: var(--text-main);
}

.page-subtitle {
    color: var(--text-muted);
    margin-top: 5px;
    font-size: 0.95rem;
}

/* ============================================
   CARD GRID (Dashboard)
   ============================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.platform-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.platform-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.card-header {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.platform-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: #f0ede4;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.platform-name {
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--text-main);
    word-break: break-word;
}

.platform-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    flex-grow: 1;
    line-height: 1.5;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}

.empty-state i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-state h3 {
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-muted);
}

.empty-state .btn-primary {
    display: inline-block;
    width: auto;
    margin-top: 20px;
    padding: 14px 30px;
}

/* ============================================
   ADMIN LAYOUT (Form + Table)
   ============================================ */
.admin-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 30px;
    align-items: start;
}

.admin-form-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 80px;
}

.admin-form-card h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 20px;
}

/* ============================================
   TABLE
   ============================================ */
.admin-table-container {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

th {
    background: #f8f9fa;
    text-align: left;
    padding: 14px 15px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

td {
    padding: 14px 15px;
    border-top: 1px solid var(--border-color);
    vertical-align: middle;
}

.td-name strong {
    display: block;
    margin-bottom: 2px;
}

.td-url {
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
    max-width: 250px;
    display: inline-block;
}

.td-cred {
    font-size: 0.85rem;
}

.td-cred-pass {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.td-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   ALERTS / TOAST
   ============================================ */
.alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

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

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

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 0.9rem;
    transform: translateY(100px);
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    max-width: calc(100vw - 40px);
}

.toast i {
    color: #4caf50;
    margin-right: 8px;
}

/* Remember me checkbox */
.remember-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: -10px;
}

.remember-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.remember-group label {
    margin-bottom: 0;
    font-weight: normal;
    color: var(--text-muted);
    cursor: pointer;
}

/* ============================================
   RESPONSIVE - LARGE DESKTOP (1920+)
   ============================================ */
@media (min-width: 1400px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 30px;
    }

    .admin-grid {
        grid-template-columns: 420px 1fr;
        gap: 40px;
    }

    main {
        padding: 50px 5%;
    }
}

/* ============================================
   RESPONSIVE - TABLET LANDSCAPE (1024 - 1199)
   ============================================ */
@media (max-width: 1199px) {
    .admin-grid {
        grid-template-columns: 350px 1fr;
        gap: 25px;
    }
}

/* ============================================
   RESPONSIVE - TABLET PORTRAIT (768 - 1023)
   ============================================ */
@media (max-width: 1023px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-form-card {
        position: static;
    }

    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* ============================================
   RESPONSIVE - MOBILE LARGE (576 - 767)
   ============================================ */
@media (max-width: 767px) {
    .navbar {
        padding: 12px 4%;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card-bg);
        flex-direction: column;
        padding: 10px 0;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
        gap: 0;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 14px 20px;
        border-radius: 0;
        width: 100%;
        font-size: 1rem;
    }

    .nav-links a:hover {
        background: rgba(158, 142, 99, 0.08);
    }

    main {
        padding: 25px 4%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-title h2 {
        font-size: 1.5rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .platform-card {
        padding: 20px;
    }

    .platform-card:hover {
        transform: none;
    }

    .auth-header h1 {
        font-size: 2rem;
    }

    .auth-card {
        padding: 25px;
    }

    .auth-card h2,
    .auth-card h3 {
        font-size: 1.3rem;
    }

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

    .admin-form-card {
        padding: 25px;
    }

    .empty-state {
        padding: 50px 20px;
    }

    .toast {
        bottom: 15px;
        right: 15px;
        left: 15px;
        text-align: center;
    }
}

/* ============================================
   RESPONSIVE - MOBILE SMALL (320 - 575)
   ============================================ */
@media (max-width: 575px) {
    html {
        font-size: 15px;
    }

    .navbar {
        padding: 10px 3.5%;
    }

    .navbar-brand {
        font-size: 1.1rem;
    }

    main {
        padding: 20px 3.5%;
    }

    .page-title h2 {
        font-size: 1.3rem;
    }

    .page-subtitle {
        font-size: 0.85rem;
    }

    .platform-card {
        padding: 18px;
    }

    .platform-icon {
        width: 42px;
        height: 42px;
        min-width: 42px;
        font-size: 1.1rem;
    }

    .platform-name {
        font-size: 1.05rem;
    }

    .auth-header h1 {
        font-size: 1.75rem;
    }

    .auth-header p {
        font-size: 0.9rem;
    }

    .auth-card {
        padding: 20px;
        border-radius: 10px;
    }

    .form-control {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .btn-primary {
        padding: 13px;
    }

    .btn-action {
        padding: 10px 12px;
        font-size: 0.83rem;
    }

    .admin-form-card {
        padding: 20px;
    }

    .empty-state {
        padding: 40px 15px;
    }

    .empty-state i {
        font-size: 2.5rem;
    }

    .auth-footer {
        margin-top: 30px;
        font-size: 0.8rem;
    }

    th, td {
        padding: 12px 10px;
    }
}

/* ============================================
   RESPONSIVE - VERY SMALL (< 320px)
   ============================================ */
@media (max-width: 359px) {
    html {
        font-size: 14px;
    }

    .navbar {
        padding: 8px 3%;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    main {
        padding: 15px 3%;
    }

    .auth-wrapper {
        padding: 15px 10px;
    }

    .auth-header {
        margin-bottom: 25px;
    }

    .auth-header h1 {
        font-size: 1.5rem;
    }

    .auth-card {
        padding: 16px;
        border-radius: 8px;
    }

    .platform-card {
        padding: 15px;
    }

    .card-header {
        gap: 10px;
    }

    .platform-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 1rem;
        border-radius: 8px;
    }

    .platform-name {
        font-size: 1rem;
    }

    .admin-form-card {
        padding: 16px;
    }
}

/* ============================================
   ACCOUNT PAGE
   ============================================ */
.account-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

.account-current {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.account-current strong {
    color: var(--text-main);
}

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

@media (max-width: 767px) {
    .account-grid {
        gap: 20px;
    }
}
