/* ============================================
   ROOT VARIABLES & GENERAL STYLES
   ============================================ */

:root {
    --primary: #3B82F6;
    --primary-dark: #1E40AF;
    --secondary: #BFDBFE;
    --success: #059669;
    --danger: #1E3A8A;
    --warning: #EA580C;
    --dark: #1F2937;
    --light: #FAFAFA;
    --border: #EEEEEE;
    --text: #374151;
    --text-light: #6B7280;
    --shadow: 0 10px 30px rgba(59, 130, 246, 0.15);
    --shadow-sm: 0 4px 12px rgba(59, 130, 246, 0.08);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
    color: var(--text);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================
   HEADER
   ============================================ */

.header {
    background: white;
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    border-left: 6px solid var(--primary);
}

.header-content h1 {
    font-size: 2.5em;
    color: var(--dark);
    margin-bottom: 5px;
}

.header-content p {
    color: var(--text-light);
    font-size: 1.1em;
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .header-content h1 {
        font-size: 2em;
    }
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: var(--light);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

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

.btn-danger:hover {
    background: #DC2626;
}

/* ============================================
   CONTROLS (Search & Filter)
   ============================================ */

.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.search-box,
.filter-box {
    flex: 1;
}

.search-box input,
.filter-box select {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1em;
    background: white;
    color: var(--text);
    transition: all 0.3s ease;
}

.search-box input:focus,
.filter-box select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-box input::placeholder {
    color: var(--text-light);
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }
}

/* ============================================
   STATS
   ============================================ */

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

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-value {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.95em;
}

/* ============================================
   PORTALS GRID
   ============================================ */

.portals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.portal-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid #F0F0F0;
}

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

.portal-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
}

.portal-icon {
    font-size: 3em;
    margin-bottom: 12px;
    display: inline-block;
    min-width: 60px;
}

.portal-title {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.portal-category {
    display: inline-block;
    background: var(--light);
    color: var(--text);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    margin-bottom: 16px;
}

.portal-url {
    color: var(--text-light);
    font-size: 0.9em;
    margin-bottom: 16px;
    word-break: break-all;
    font-family: 'Monaco', monospace;
}

.portal-actions {
    display: flex;
    gap: 10px;
}

.portal-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.portal-btn-open {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.portal-btn-open:hover {
    transform: scale(1.05);
}

.portal-btn-edit {
    background: var(--light);
    color: var(--text);
    border: 1px solid var(--border);
}

.portal-btn-edit:hover {
    background: var(--border);
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: white;
    font-size: 1.1em;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    color: var(--text-light);
}

/* ============================================
   MODAL
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--dark);
    font-size: 1.5em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2em;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--light);
    color: var(--dark);
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-footer .btn {
    margin: 0;
}

.modal-footer .btn-danger {
    margin-right: auto;
}

/* ============================================
   FORM
   ============================================ */

form {
    padding: 24px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark);
    font-weight: 600;
    font-size: 0.95em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1em;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input[type="color"] {
    height: 44px;
    cursor: pointer;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .portals-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .header {
        padding: 24px;
    }

    .header-content h1 {
        font-size: 1.8em;
    }

    .modal-content {
        width: 95%;
        max-width: 90vw;
    }

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

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

    .header-content h1 {
        font-size: 1.5em;
    }

    .stat-value {
        font-size: 2em;
    }

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

