/**
 * T2M URL Shortener - Main Stylesheet (Performance Optimized)
 * 
 * This CSS file contains all styling for the URL shortener application.
 * Optimized for performance with reduced specificity and organized sections.
 * 
 * @author T2M Team
 * @version 1.1.0 - Performance Enhanced
 */

/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* ==========================================================================
   Layout Container
   ========================================================================== */

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

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */

.sidebar {
    width: 250px;
    background: #1e293b;
    color: #fff;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.logo img {
    width: 100px;
    margin-bottom: 20px;
}

/* User Info Section */
.user-info {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-weight: 700;
    font-size: 18px;
}

.user-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.user-role {
    font-size: 13px;
    color: #10b981;
    margin-bottom: 10px;
}

.premium-btn {
    background: #10b981;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.premium-btn:hover {
    background: #059669;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    color: #fff;
    text-decoration: none;
    padding: 12px 15px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
}

.nav-item.active {
    background: #10b981;
}

.nav-item .icon {
    font-size: 16px;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */

.main-content {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
}

/* Top Header Bar */
.top-bar {
    background: #fff;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.menu-toggle {
    background: #10b981;
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logout-btn {
    color: #10b981;
    text-decoration: none;
    font-weight: 500;
}

.logout-btn:hover {
    text-decoration: underline;
}

/* Content Area */
.content-area {
    padding: 30px;
    flex: 1;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.breadcrumb a {
    color: #10b981;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Headings */
h1 {
    font-size: 28px;
    margin-bottom: 20px;
    font-weight: 700;
}

/* ==========================================================================
   Buttons & Actions
   ========================================================================== */

.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #10b981;
    color: #fff;
}

.btn-primary:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

.btn-secondary {
    background: #3b82f6;
    color: #fff;
}

.btn-secondary:hover {
    background: #2563eb;
}

.btn-block {
    width: 100%;
}

/* ==========================================================================
   Alerts & Notifications
   ========================================================================== */

.alert {
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

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

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

.note {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-container {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.table-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.btn-filters {
    background: #10b981;
    color: #fff;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.url-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.url-table th {
    background: #f9fafb;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
}

.url-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.url-table tr:hover {
    background: #f9fafb;
}

/* Table Links */
.short-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    word-break: break-all;
}

.short-link:hover {
    text-decoration: underline;
}

.long-url {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-actions {
    margin-top: 8px;
    display: flex;
    gap: 15px;
}

.url-actions a {
    color: #666;
    text-decoration: none;
    font-size: 12px;
}

.url-actions a:hover {
    color: #10b981;
}

.view-link {
    color: #3b82f6;
    text-decoration: none;
}

.expiry-link {
    color: #10b981;
    text-decoration: none;
}

/* Share Buttons */
.share-buttons {
    display: flex;
    gap: 5px;
}

.share-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #fff;
    font-weight: 700;
    transition: transform 0.2s;
}

.share-btn:hover {
    transform: scale(1.1);
}

.share-btn.facebook {
    background: #1877f2;
}

.share-btn.twitter {
    background: #000;
}

.share-btn.more {
    background: #10b981;
}

.empty-state {
    text-align: center;
    padding: 40px !important;
    color: #999;
    font-size: 16px;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
    background: #fff;
    padding: 20px 30px;
    text-align: center;
    border-top: 1px solid #e5e7eb;
    font-size: 14px;
    color: #666;
}

/* ==========================================================================
   Modal Dialogs
   ========================================================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

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

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: slideDown 0.3s ease;
}

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

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: 700;
    color: #999;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
}

/* ==========================================================================
   Forms
   ========================================================================== */

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #10b981;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

/* ==========================================================================
   Login Page
   ========================================================================== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-box h1 {
    color: #10b981;
    margin-bottom: 10px;
    text-align: center;
}

.login-box h2 {
    font-size: 20px;
    margin-bottom: 30px;
    text-align: center;
    color: #666;
}

.login-info {
    margin-top: 20px;
    padding: 15px;
    background: #f0fdf4;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
}

.login-info code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .main-content {
        margin-left: 60px;
    }
    
    .user-info .user-name,
    .user-info .user-role,
    .user-info .premium-btn,
    .nav-item span:not(.icon) {
        display: none;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .url-table {
        font-size: 12px;
    }
    
    .url-table th,
    .url-table td {
        padding: 8px;
    }
    
    .long-url {
        max-width: 200px;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

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

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

.visible {
    display: block;
}
