:root {
    --primary-color: #006837;
    --secondary-color: #008542;
    --background-light: #ffffff;
    --text-light: #1f2937;
    --border-light: #e5e7eb;
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --header-height: 70px;
}

[data-theme="dark"] {
    --primary-color: #008542;
    --secondary-color: #00a651;
    --background-light: #1f2937;
    --text-light: #f3f4f6;
    --border-light: #374151;
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

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

body {
    background-color: var(--background-light);
    color: var(--text-light);
    transition: all 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--header-height);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    flex: 1;
    position: relative;
    z-index: 1;
}

/* Header Styles */
header {
    background-color: var(--primary-color);
    padding: 0.5rem 0;
    box-shadow: var(--shadow-light);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
}

.header-content > div {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0px;
    text-align: center;
    font-family: 'Cairo', sans-serif;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo img {
    height: 50px;
    width: auto;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.menu-close {
    background: var(--primary-color);
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.menu-close:hover {
    background-color: var(--secondary-color);
    transform: scale(1.1);
}

/* Side Menu */
.side-menu {
    position: fixed;
    right: -100%;
    top: 0;
    width: 300px;
    height: 100vh;
    background-color: var(--background-light);
    box-shadow: var(--shadow-light);
    transition: right 0.3s ease;
    z-index: 999;
    overflow-y: auto;
    padding: calc(var(--header-height) + 1rem) 1rem 1rem 1rem;
}

.side-menu.active {
    right: 0;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.menu-items {
    list-style: none;
}

.menu-item {
    margin-bottom: 1rem;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 0.5rem;
}

.menu-link:hover {
    background-color: var(--border-light);
}

.menu-link i {
    margin-left: 0.75rem;
    width: 20px;
    text-align: center;
}

.submenu {
    list-style: none;
    margin-right: 2rem;
    margin-top: 0.5rem;
    display: none;
}

.submenu.active {
    display: block;
}

/* Welcome Section */
.welcome-section {
    padding: 2rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.welcome-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-light);
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.welcome-card h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 2rem;
}

.welcome-description {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.8;
}

.welcome-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 103, 55, 0.1);
}

.feature-item i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.welcome-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* Login/Register Sections */
.login-section, .register-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 2rem 0;
}

.login-card, .register-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-light);
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.login-card h2, .register-card h2 {
    margin-bottom: 30px;
    color: var(--primary-color);
    font-size: 1.8rem;
}

/* Form Elements */
.input-field {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 103, 55, 0.1);
}

.btn {
    padding: 15px 25px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 120px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 103, 55, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(86, 171, 47, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%);
    color: white;
}

.btn-info:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(23, 162, 184, 0.3);
}

/* Auth Links */
.auth-links {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.link-button {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.link-button:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Admin Panel */
.admin-panel {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-light);
    margin: 20px 0;
}

/* Admin Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.user-info h2 {
    color: var(--primary-color);
    margin: 0 0 5px 0;
}

.welcome-text {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 103, 55, 0.3);
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.3);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    box-shadow: 0 8px 25px rgba(67, 233, 123, 0.3);
}

.stat-card h3 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    display: block;
}

.stat-text {
    font-size: 1.2rem;
    font-weight: 600;
    display: block;
}

/* Add Link Section */
.add-link-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 40px;
    border: 2px solid #e9ecef;
}

.add-link-section h2 {
    margin-bottom: 25px;
    color: var(--primary-color);
}

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

.form-grid .btn {
    grid-column: span 2;
}

.preview-section {
    text-align: center;
    margin-top: 15px;
}

.help-text {
    color: #6c757d;
    font-size: 14px;
    margin-top: 10px;
}

#linkPreview {
    font-weight: 600;
    color: var(--primary-color);
    background: #e7f3e8;
    padding: 2px 8px;
    border-radius: 5px;
}

/* Links Management */
.links-section {
    margin-top: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-header h2 {
    color: var(--primary-color);
}

.section-header div {
    display: flex;
    gap: 10px;
}

.links-list {
    display: grid;
    gap: 15px;
}

.link-item {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.link-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(0, 103, 55, 0.1);
}

.link-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.link-info h3 {
    color: var(--primary-color);
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.link-id {
    color: var(--primary-color);
    font-weight: 600;
    background: #e7f3e8;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 14px;
    margin-left: 10px;
}

.link-owner {
    color: #6c757d;
    font-size: 12px;
    display: block;
    margin-top: 5px;
}

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

.link-actions .btn {
    padding: 8px 15px;
    font-size: 14px;
    min-width: auto;
}

.link-details {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    align-items: center;
}

.link-url {
    color: #6c757d;
    font-size: 14px;
    word-break: break-all;
}

.link-stats {
    text-align: center;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
}

.click-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.click-label {
    font-size: 12px;
    color: #6c757d;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* Messages */
.message {
    position: fixed;
    top: calc(var(--header-height) + 20px);
    left: 50%;
    transform: translateX(-50%);
    max-width: 400px;
    padding: 15px 20px;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

.message.success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    color: white;
}

.message.error {
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
    color: white;
}

/* Notification */
.notification {
    position: fixed;
    top: calc(var(--header-height) + 20px);
    right: 20px;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-light);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification.show {
    transform: translateX(0);
}

/* Error/Success Messages */
.error {
    color: #e74c3c;
    background: #fdf2f2;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
}

.success {
    color: #27ae60;
    background: #f0f9f4;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
}

/* Hash Section (for register page) */
.hash-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin: 25px 0;
    text-align: left;
}

.hash-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

.hash-display {
    margin-bottom: 15px;
}

.hash-display label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.hash-field {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    resize: vertical;
    background: #fff;
    transition: all 0.3s ease;
}

.hash-field:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 103, 55, 0.1);
}

.hash-tools {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: center;
    margin-top: auto;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

h3 {
    margin-bottom: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    .container {
        padding: 0.75rem;
    }

    .header-title {
        font-size: 1.2rem;
    }

    .title {
        font-size: 2rem;
    }

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

    .form-grid .btn {
        grid-column: span 1;
    }

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

    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .section-header div {
        justify-content: center;
    }

    .link-header {
        flex-direction: column;
        gap: 15px;
    }

    .link-details {
        grid-template-columns: 1fr;
    }

    .link-actions {
        justify-content: center;
    }

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

    .hash-tools {
        flex-direction: column;
    }

    .admin-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .side-menu {
        width: 85%;
        max-width: 300px;
    }

    .welcome-features {
        grid-template-columns: 1fr;
    }

    .welcome-actions {
        flex-direction: column;
        align-items: center;
    }

    .auth-links {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .welcome-card {
        padding: 20px;
    }

    .login-card, .register-card {
        padding: 20px;
    }

    .admin-panel {
        padding: 15px;
    }

    .add-link-section {
        padding: 15px;
    }
}