@tailwind base;
@tailwind components;
@tailwind utilities;

/* ============================================================
   ADMIN PANEL - LEGACY STYLES (preserved for compatibility)
   These were previously in public/css/admin.css
   ============================================================ */

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* ============================================
   LAYOUT
   ============================================ */

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

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.admin-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

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

.admin-header {
    background: white;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 72px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    letter-spacing: -0.5px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.page-title-jp {
    font-size: 24px;
    color: #64748b;
    font-weight: 500;
    font-family: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', sans-serif;
}

/* ============================================
   HEADER ACTIONS & DROPDOWNS
   ============================================ */

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.header-btn {
    position: relative;
    height: 40px;
    border-radius: 28px;
    border: 1px solid #e2e8f0;
    background: white;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #475569;
}

.header-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.header-btn svg {
    width: 20px;
    height: 20px;
    color: #475569;
    flex-shrink: 0;
}

.notification-btn {
    width: 40px;
    padding: 0;
    justify-content: center;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.user-btn {
    padding-right: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 28px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-name {
    font-weight: 600;
    color: #1e293b;
}

.dropdown-icon {
    width: 16px;
    height: 16px;
    color: #94a3b8;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-dropdown {
    min-width: 320px;
    right: 52px;
}

.dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-header strong {
    font-size: 14px;
    color: #1e293b;
}

.badge-small {
    background: #3b82f6;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #f8fafc;
    color: #1e293b;
}

.dropdown-item svg {
    flex-shrink: 0;
}

.dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
}

.logout-item {
    color: #ef4444;
}

.logout-item:hover {
    background: #fef2f2;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: #f8fafc;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-size: 13px;
    color: #1e293b;
    font-weight: 500;
    margin-bottom: 2px;
}

.notification-time {
    font-size: 12px;
    color: #94a3b8;
}

.dropdown-footer {
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.dropdown-footer a {
    color: #3b82f6;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.dropdown-footer a:hover {
    color: #2563eb;
}

.notification-item.unread {
    background: #eff6ff;
}

.notification-item.unread:hover {
    background: #e0f2fe;
}

.notification-item.unread .notification-title {
    font-weight: 700;
}

.notification-empty {
    padding: 24px 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

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

.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 14px;
    font-weight: 500;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* ============================================
   TABLES
   ============================================ */

table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    margin-top: 20px;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: bold;
}

tr:hover {
    background-color: #f5f5f5;
}

/* ============================================
   DASHBOARD METRICS
   ============================================ */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: white;
    border-radius: 8px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s;
    border-top: 2px solid;
    position: relative;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.metric-card.primary { border-top-color: #3b82f6; }
.metric-card.success { border-top-color: #10b981; }
.metric-card.warning { border-top-color: #f59e0b; }
.metric-card.danger { border-top-color: #ef4444; }
.metric-card.purple { border-top-color: #8b5cf6; }
.metric-card.info { border-top-color: #06b6d4; }

.metric-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 18px;
    height: 18px;
    opacity: 0.15;
}

.metric-card.primary .metric-icon { color: #3b82f6; }
.metric-card.success .metric-icon { color: #10b981; }
.metric-card.warning .metric-icon { color: #f59e0b; }
.metric-card.danger .metric-icon { color: #ef4444; }
.metric-card.purple .metric-icon { color: #8b5cf6; }
.metric-card.info .metric-icon { color: #06b6d4; }

.metric-icon svg {
    width: 18px;
    height: 18px;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
    margin-bottom: 6px;
}

.metric-change {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.metric-change.positive {
    color: #10b981;
}

/* ============================================
   CHARTS
   ============================================ */

.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.charts-row-custom {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card-small {
    min-width: 0;
}

.chart-card-large {
    min-width: 0;
}

@media (max-width: 1200px) {
    .charts-row-custom {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: white;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chart-header {
    margin-bottom: 14px;
}

.chart-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 3px 0;
}

.chart-subtitle {
    font-size: 12px;
    color: #64748b;
}

.chart-container {
    height: 220px;
    width: 100%;
}

/* ============================================
   DATA CARDS & TABLES
   ============================================ */

.tables-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.data-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.data-header {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.data-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.view-all {
    font-size: 12px;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
}

.view-all:hover {
    color: #2563eb;
}

.data-content {
    padding: 12px 18px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.user-item:last-child {
    border-bottom: none;
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}

.user-stat {
    font-size: 11px;
    color: #64748b;
}

.user-badge {
    font-size: 16px;
}

.user-badge.new {
    background: #10b981;
    color: white;
    font-size: 9px;
    padding: 3px 7px;
    border-radius: 5px;
    font-weight: 700;
}

/* ============================================
   ACTIVITY
   ============================================ */

.activity-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.activity-header {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
}

.activity-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 3px 0;
}

.activity-subtitle {
    font-size: 12px;
    color: #64748b;
}

.activity-table {
    overflow-x: auto;
}

.activity-table table {
    width: 100%;
    margin: 0;
}

.activity-table th {
    background: #f8fafc;
    padding: 12px 18px;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-table td {
    padding: 12px 18px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}

.activity-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.activity-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 12px;
}

.activity-badge {
    background: #ede9fe;
    color: #8b5cf6;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.activity-card-text {
    color: #475569;
    font-size: 14px;
}

.activity-time {
    color: #94a3b8;
    font-size: 13px;
}

.empty-state {
    text-align: center;
    color: #94a3b8;
    padding: 40px 20px;
    font-size: 14px;
}

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

@media (max-width: 768px) {
    .admin-header {
        padding: 12px 20px;
        height: auto;
    }

    .page-title {
        font-size: 20px;
    }

    .page-title-jp {
        font-size: 20px;
    }

    .user-name {
        display: none;
    }

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

    .charts-row {
        grid-template-columns: 1fr;
    }

    .tables-row {
        grid-template-columns: 1fr;
    }

    .admin-content {
        padding: 20px;
    }
}
