* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --accent: #f093fb;
    --success: #4ade80;
    --danger: #f87171;
    --warning: #fbbf24;
    --bg-dark: #0f0f23;
    --bg-darker: #050510;
    --bg-light: #1a1a2e;
    --text: #ffffff;
    --text-muted: #a0a0b8;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-darker);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: var(--bg-light);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

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

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

.login-header {
    margin-bottom: 2rem;
}

.login-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.login-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--text-muted);
}

.login-form, .modal-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    text-align: left;
}

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

.form-input, .form-textarea, .template-select {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-input:focus, .form-textarea:focus, .template-select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.form-hint {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.description-with-template {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.template-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23667eea'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.5rem;
    padding-right: 3rem;
    appearance: none;
}

.template-select option {
    background: #fff;
    color: #2d3748;
    padding: 0.75rem;
}

.template-select option:hover {
    background: #667eea;
    color: #fff;
}

.btn-login, .btn-primary, .btn-secondary {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-login, .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-login:hover, .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 2px solid var(--card-border);
}

.btn-secondary:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(239, 68, 68, 0.4);
}

.btn-edit {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 0.5rem;
}

.btn-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-copy {
    background: linear-gradient(135deg, #667eea, #f093fb);
    color: white;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-copy svg {
    width: 16px;
    height: 16px;
    stroke: white;
    fill: none;
}

.btn-copy:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.arrow-icon {
    width: 18px;
    height: 18px;
}

.error-message {
    color: var(--danger);
    font-size: 0.9rem;
    text-align: center;
    margin-top: 0.5rem;
    min-height: 1.2rem;
}

.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--bg-dark);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-header {
    padding: 2rem;
    border-bottom: 1px solid var(--card-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 2rem;
}

.logo-text {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    background: none;
    width: 100%;
    text-align: left;
    border: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
}

.menu-item:hover {
    color: var(--text);
    background: rgba(102, 126, 234, 0.1);
    border-left-color: var(--primary);
}

.menu-item.active {
    color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
    border-left-color: var(--primary);
}

.menu-item svg {
    width: 20px;
    height: 20px;
}

.sidebar-footer {
    padding: 1.5rem 0;
    border-top: 1px solid var(--card-border);
}

.main-content {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.content-header h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.content-header .btn-primary svg {
    width: 20px;
    height: 20px;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.stat-card .stat-icon {
    font-size: 3rem;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.data-table-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: rgba(102, 126, 234, 0.1);
}

.data-table th {
    padding: 1.25rem 1.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--card-border);
    color: var(--text-muted);
}

.data-table tbody tr {
    transition: all 0.3s ease;
}

.data-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.no-data {
    text-align: center;
    padding: 3rem !important;
    color: var(--text-muted);
    font-style: italic;
}

.short-code-cell {
    font-family: 'Courier New', monospace;
    color: var(--primary);
    font-weight: 600;
}

.url-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.template-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    transition: all 0.3s ease;
}

.template-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.template-card.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    grid-column: 1 / -1;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.template-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.template-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.template-body {
    margin-bottom: 1.5rem;
}

.template-field {
    margin-bottom: 1rem;
}

.template-field-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.template-field-value {
    color: var(--text);
    line-height: 1.6;
}

.template-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--card-border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.modal-actions button {
    flex: 1;
}

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

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 0;
    }

    .nav-item {
        white-space: nowrap;
        min-width: auto;
        padding: 1rem 1.5rem;
    }

    .main-content {
        padding: 2rem 1rem;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

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

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

    .data-table {
        min-width: 800px;
    }

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

@media (max-width: 768px) {
    .login-modal-content {
        padding: 2rem;
        width: 90%;
        max-width: 400px;
    }

    .modal-content {
        width: 95%;
        max-width: 500px;
        padding: 2rem 1.5rem;
    }

    .stats-card {
        padding: 1.25rem;
    }

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

    .action-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .btn-copy, .btn-edit, .btn-danger {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }

    .btn-copy {
        padding: 0.4rem 0.6rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    .form-input, .form-textarea {
        font-size: 16px;
    }

    .template-card {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .login-modal-content {
        padding: 1.5rem;
        width: 95%;
    }

    .login-title {
        font-size: 1.75rem;
    }

    .modal-content {
        width: 98%;
        padding: 1.5rem 1rem;
        max-height: 90vh;
    }

    .modal-title {
        font-size: 1.5rem;
    }

    .sidebar-logo {
        font-size: 1.25rem;
    }

    .nav-item {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .main-content {
        padding: 1rem 0.5rem;
    }

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

    .btn-primary {
        font-size: 0.9rem;
        padding: 0.75rem 1.25rem;
        width: 100%;
    }

    .stat-icon {
        font-size: 2rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }

    .short-code-cell {
        font-size: 0.8rem;
    }

    .action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn-copy, .btn-edit, .btn-danger {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.25rem;
    }

    .template-card {
        padding: 1rem;
    }

    .template-name {
        font-size: 1.1rem;
    }

    .form-input, .form-textarea, .template-select {
        font-size: 16px;
    }

    .modal-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .modal-actions .btn-primary,
    .modal-actions .btn-secondary {
        width: 100%;
    }
}
